home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / amac44c.zip / RFR003.QM < prev    next >
Text File  |  1992-06-22  |  41KB  |  876 lines

  1. *                               rfr003.qm
  2. *                            Macros To Format
  3. *                        Written By Tom Hogshead
  4. *                       [ See RFRMxx.QM For Use ]
  5. *                                 6/22/92
  6. *
  7. *  Key   Subfile                Description                          Bytes
  8. * =====  ========   ===============================================  =====
  9. *  @3             - Formats Commented or Uncommented Paragraph, ( )   157 |chg
  10. *                   Reverses Commenting
  11. *
  12. *  @4             - Formats Commented or Uncommented Paragraph,       158 |chg
  13. *                   Leaves Paragraph Commenting 'As Is'
  14. *
  15. *                   Format Paragraph With or W/O Multiple Indentions
  16. *  @f5                - To Current Rt Margin and Lft Margin Col 1      36
  17. *  @f6                - Pauses For User Selected Lft and Rt Margins   111
  18. *  @f7                - Without Pause To Lft and Rt Margins           102
  19. *                       Set With @f6, @f8 or Last GoToColumn 'nn'
  20. *
  21. *  @f9            - Format Paragraph With No Multiple Indentions       52
  22. *                   Without Pause To Lft and Rt Margins
  23. *                   Set With @f8, @f6 or Last GoToColumn 'nn'
  24. *
  25. *  @f8            - Format Lines In Any Type Block,                   111
  26. *                   Pauses For User Selected Lft and Rt Margins
  27. *
  28. *                   Format Lines In Any Type Block
  29. *                   To Current Rt Margin Setting
  30. *  @8                 - Small Version   < BEST >                       33
  31. *  @5                 - Uses Temp File, Technique only                 96
  32. *
  33. *  @7             - Format Paragraph To Current Rt Margin Setting       8
  34. *  @9             - Format File To Current Rt Margin Setting           10
  35. *  @2             - Format Column Block To a Rt Margin of 60           54
  36. *
  37. *                   Format ONLY Lines Wider Than Rt Margin 80
  38. *  @f1                - QEdit v2.15 Only    (Fast)   < BEST >
  39. *  @f2                - QEdit v2.10 or 2.15 (Slow)
  40. *
  41. *  @0               GENERIC Macro To Process Blocks
  42. *
  43. *  ^f7              Format Message Reader Messages (Tim Farley)
  44. *  @8   {e:\up\msg002} - Format Message Reader Messages--I use this macro!
  45. *
  46. *     (Fix) For Different Qconfig Settings
  47. *     To Insert Blocks Above/Below Cursor Line
  48. *
  49. *         {e:\up\RFRM*}--Return To RFRMxx.QM
  50. *
  51. *-- eoi
  52.  
  53.  
  54. *                            M A C R O S
  55. * ----------------------------------------------------------------------
  56. * @(2) Format Column Block To Right Margin of 60
  57. * ----------------------------------------------------------------------
  58. * This macro will format an open or closed column block marked
  59. * before invoking to a right mardin of 60.
  60.  
  61. @2      MacroBegin
  62.         setscreenoff                                * Remove if not v2.15
  63.         editfile "nul" return quit                  * Quit nul if loaded
  64.         GotoBlockBeg JFalse END
  65.         EditFile Return                             * Load empty nul file
  66.  
  67.         moveblock
  68.         SetRmargin "60" Return
  69.   WRAP: wrappara nextpara jtrue WRAP                * Format all para's
  70.         SetRmargin "80" Return
  71.         GotoColumn "512" Return markcolumn begfile  * Make wide col blk
  72.         Copy Quit
  73.         cursorright                                 * Paste with space
  74.         PasteOver MakeCtrOfScreen
  75.    END:
  76.         UnmarkBlock
  77. *
  78. * 54 bytes Thu  12-19-1991  13:21:42 (TH @2)
  79.  
  80.  
  81. * 
  82. * ----------------------------------------------------------------------
  83. * @(3)  Formats Commented or Uncommented Paragraph,
  84. *       Reverses Commenting,
  85. *       Replaces "period space" with "period two spaces"
  86. * ----------------------------------------------------------------------
  87. * This macro formats a paragraph to a column width of 69.  Before macro
  88. * execution the paragraph may either  be commented with an asterisk and
  89. * space in  column 1 or uncommented.   All occurrences in the paragraph
  90. * of  "period  space" are replaced  with  "period two  spaces".  If the
  91. * paragraph  has already been  commented before macro  execution, it is
  92. * formatted  and uncommented.   If the  paragraph has  not already been
  93. * commented, it is formatted  and commented.  Invoking this macro twice
  94. * will return  the paragraph to it's  original commented or uncommented
  95. * state, but  formatted.  This macro  will not work  correctly if blank
  96. * lines are commented.
  97.  
  98. * To run,  invoke @3 with  the cursor located  anywhere in a paragraph.
  99. * If the  cursor is located between  paragraphs, the previous paragraph
  100. * is formatted.  After  this macro ends, the  cursor is returned to the
  101. * beginning of the formatted paragraph.  The user may insert 'nextpara'
  102. * at the end of the macro to  return the cursor to the beginning of the
  103. * next paragraph after macro execution.     Macro requires QEdit v2.15.
  104.  
  105.  
  106. @3 macrobegin
  107.         setscreenoff
  108.         unmarkblock
  109.         setrmargin "69" return
  110.         cursordown prevpara begline
  111.         markcharacter endpara markcharacter prevpara
  112.     * ------ Insert Empty Line if Paragraph Includes Title Box ------*
  113.     END_TITLE_BOX:
  114.         find '* ---' return 'L' return
  115.     jtrue END_TITLE_BOX
  116.         cursorup
  117.         find return 'L' return
  118.     jfalse START
  119.         addline
  120.         nextpara markcharacter
  121.         endpara markcharacter
  122.         prevpara
  123.     START:
  124.         insertline cursordown           * Insert blank line on top
  125.     * ------------- Check if paragraph already commented -------------*
  126.         cursordown
  127.         begline
  128.         cursorright
  129.         find "*" return "LB" return
  130.     Jfalse COMMENT
  131.     * ---------------- Uncomment And Format Paragraph ----------------*
  132.     UNCOMMENT:
  133.         shiftleft shiftleft
  134.         gotoblockbeg
  135.         wrappara
  136.         prevpara
  137.     jump FORMATTED
  138.     * ----------------- Comment And Format Paragraph -----------------*
  139.     COMMENT:
  140.         gotoblockbeg                                                     *:17
  141.         wrappara
  142.         gotoblockend
  143.         shiftright shiftright
  144.         begline
  145.         unmarkblock markcolumn
  146.         prevpara
  147.         begline markcolumn
  148.         fillblock '*' return
  149.         markline
  150.         endpara
  151.         markline
  152.         prevpara                                                         *:17
  153.     FORMATTED:
  154.     * ------ Move Paragraph to Bottom of Title Box if it Exists ------*
  155.         cursorup
  156.         isemptyline jfalse 1                                             *:17
  157.         delline
  158.     1:                                                                   *:17
  159.         cursorup cursorup
  160.         markline
  161.         find '---' return 'L' return
  162.     jfalse NO_TITLE
  163.         cursordown
  164.         isemptyline jfalse REPOS                                         *:17
  165.         delline
  166.     jump REPOS
  167.     NO_TITLE:
  168.         cursordown cursordown
  169.     REPOS:
  170.     * ------- Replaces "Period Space" With "Period two spaces" -------*
  171.         findreplace ". "   return ".  "  return "LN" return
  172.         findreplace ".   " return        return "LN" return
  173.     END:
  174.         begline
  175.         unmarkblock
  176.         makectrofscreen
  177. *
  178. * 97 bytes Thu  08-08-1991  14:03:38 (TH @3, in rfr003.qm)
  179. * 98 bytes Tue  12-10-1991  06:29:28 (TH @3, added begline for line 1)
  180. * 95 bytes Tue  12-10-1991  06:45:16 (TH @3, removed jfalse END)
  181. * 96 bytes Tue  12-10-1991  06:51:08 (TH @3, added setscreenoff)
  182. * 157 bytes Mon  06-15-1992  17:06:07 (TH @3, for para next to title box)
  183. * 167 bytes Wed  06-17-1992  11:36:30 (TH @3, corrected)
  184. * 167 bytes Wed  06-17-1992  11:42:35 (TH @3)
  185.  
  186.  
  187.  
  188.  
  189. * 
  190. * ----------------------------------------------------------------------
  191. * @(4)  Formats Commented or Uncommented Paragraph,
  192. *       Leaves Paragraph Uncommenting As Is,
  193. *       Replaces "period space" With "period two spaces"
  194. * ----------------------------------------------------------------------
  195. * This  macro formats  a  paragraph that  is  either commented  with an
  196. * asterisk and space in  column 1 or uncommented,  to a column width of
  197. * 69,  and  replaces "period  space"  with "period  two  spaces".  This
  198. * macro differs from @3 in that  @4 does not change the commented state
  199. * of the  paragraph, i.e.   it leaves  a commented  paragraph commented
  200. * after  reformatting  and an  uncommented  paragraph  uncommented, but
  201. * commented.
  202.  
  203. * To run, invoke @4 with the  cursor located anywhere in the paragraph.
  204. * If the cursor  is located between  paragraphs, the previous paragraph
  205. * is formatted.  After  this macro ends, the  cursor is returned to the
  206. * beginning of the formatted paragraph.  The user may insert 'nextpara'
  207. * at the end of the macro to  return the cursor to the beginning of the
  208. * next paragraph  after macro  execution.   Macro requires QEdit v2.15.
  209.  
  210. @4 macrobegin
  211.         setscreenoff
  212.         unmarkblock
  213.         setrmargin "69" return
  214.         cursordown prevpara begline
  215.         markcharacter endpara markcharacter prevpara
  216.     * ------ Insert Empty Line if Paragraph Includes Title Box ------*
  217.     END_TITLE_BOX:
  218.         find '* ---' return 'L' return
  219.     jtrue END_TITLE_BOX
  220.         cursorup
  221.         find return 'L' return
  222.     jfalse START
  223.         addline
  224.         nextpara markcharacter
  225.         endpara markcharacter
  226.         prevpara
  227.     START:
  228.         insertline cursordown           * Insert blank line on top
  229.     * ------------- Check if paragraph already commented -------------*
  230.         cursordown
  231.         begline
  232.         cursorright
  233.         find "*" return "LB" return
  234.     jtrue UNCOMMENT
  235. *   Jfalse COMMENT
  236.         gotoblockbeg                                                     *:17
  237.         wrappara
  238.         prevpara
  239.     jump FORMATTED
  240.     * ---------------- Uncomment And Format Paragraph ----------------*
  241.     UNCOMMENT:
  242.         shiftleft shiftleft
  243.         wrappara
  244.         prevpara
  245. *   jump FORMATTED
  246.     * ----------------- Comment NO Format Paragraph -----------------*
  247.     COMMENT:
  248. *       wrappara
  249.         gotoblockend
  250.         shiftright shiftright
  251.         begline
  252.         unmarkblock markcolumn
  253.         prevpara
  254.         begline markcolumn
  255.         fillblock '*' return
  256.         markline
  257.         endpara
  258.         markline
  259.         prevpara                                                         *:17
  260. *       gotoblockbeg
  261.     FORMATTED:
  262.     * ------ Move Paragraph to Bottom of Title Box if it Exists ------*
  263.         cursorup
  264.         isemptyline jfalse 1                                             *:17
  265.         delline                * Remove blank line
  266.     1:                                                                   *:17
  267.         cursorup cursorup
  268.         markline
  269.         find '---' return 'L' return
  270.     jfalse NO_TITLE
  271.         cursordown
  272.         isemptyline jfalse REPOS                                         *:17
  273.         delline              * Delete blank between para/title
  274.     jump REPOS
  275.     NO_TITLE:
  276.         cursordown cursordown
  277.     REPOS:
  278.     * ------- Replaces "Period Space" With "Period two spaces" -------*
  279.         findreplace ". "   return ".  "  return "LN" return
  280.         findreplace ".   " return        return "LN" return
  281.     END:
  282.         begline
  283.         unmarkblock
  284.         makectrofscreen
  285. *
  286. * 97 bytes Thu  08-08-1991  14:24:28 (TH @4, in rfr003.qm)
  287. * 96 bytes Wed  12-18-1991  17:55:19 (TH @4)
  288. * 96 bytes Wed  12-18-1991  20:36:35 (TH @4)
  289. * 158 bytes Mon  06-15-1992  17:05:34 (TH @4, for para next to title box)
  290. * 167 bytes Wed  06-17-1992  11:36:15 (TH @4, corrected)
  291. * 167 bytes Wed  06-17-1992  11:42:16 (TH @4)
  292.  
  293. * 
  294. * ----------------------------------------------------------------------
  295. * @(5) Format All Lines Containing Any Type Block,
  296. *      Uses Temp File, Requires QEdit v2.15
  297. * ----------------------------------------------------------------------
  298. * This macro will format all lines containing any type open or closed
  299. * block to  current right  margin.  If a  block is  not marked before
  300. * execution, cursor down  to the end  of the desired  block and press
  301. * <enter> after  invoking.  This  macro operates  irrespective of all
  302. * toggles and  qconfig settings.   See @8  for small  version of this
  303. * macro.
  304.  
  305. @5      macrobegin onewindow
  306.         cursorright gotoblockend jtrue A markline
  307.         gotoblockend jtrue OK makectrofscreen Pause jump B
  308.      A: gotoblockbeg unmarkblock markline prevposition
  309.      B: markline
  310.     OK: setscreenoff                                * Remove if not v2.15
  311.         addline 10                                  * Change if needed
  312.         editfile "NUL" return quit gotoblockbeg cut
  313.         paste fillblock " " return
  314.         horizontalwindow editfile return paste      * Paste block to nul
  315.         gotoblockend cursordown jtrue DEL begfile   * (fix) for diff qconfig
  316.    DEL: endline begline jtrue NEXT                  * Test if line is empty
  317.         delline                                     * Delete extra line
  318.   NEXT:
  319. *--<<<< Process block >>>>
  320.         gotoblockbeg                                * Position to format
  321.   WRAP: wrappara nextpara jtrue WRAP                * Format all para's
  322.         begfile unmarkblock markcolumn
  323.         endfile gotocolumn "512" return
  324.         cut quit
  325.         prevwindow onewindow pasteover              * Paste block back
  326.         gotoblockend cursordown CURSORDOWN                                 *|b
  327.   LOOP: delline endline begline jfalse LOOP         * Removes extra lines
  328.   DONE: unmarkblock
  329. * DONE: insertline nextpara unmarkblock  * Use this line to insertline
  330. *       gotoblockbeg unmarkblock  * Use this line to end at block begin
  331. *
  332. * 95 bytes Wed  12-18-1991  17:11:06 (TH @5)
  333. * 94 bytes Wed  01-01-1992  15:09:31 (TH @5, shortened)
  334. * 95 bytes Fri  04-24-1992  12:18:09 (TH @5, corrected)
  335. * 96 bytes Tue  04-28-1992  10:33:52 (TH @5, ins/keep empty line at eob +|b)
  336.  
  337. * 
  338. * ----------------------------------------------------------------------
  339. * @(7) Format Paragraph
  340. * ----------------------------------------------------------------------
  341. @7 Macrobegin Cursordown Prevpara Wrappara Nextpara
  342. *
  343. * 8 bytes Thu  08-08-1991  14:02:17 (TH @7)
  344.  
  345. * 
  346. * ----------------------------------------------------------------------
  347. * @(8) Format All Lines Containing Any Type Block, Small Version of @5,
  348. *      Requires QEdit v2.15
  349. * ----------------------------------------------------------------------
  350. * This macro will format all lines containing any type open or closed
  351. * block to  current right  margin.  If a  block is  not marked before
  352. * execution, cursor down  to the end  of the desired  block and press
  353. * <enter>  after  invoking.   This  macro will  fit  on  one  line of
  354. * qconfig.dat and  operates irrespective  of all  toggles and qconfig
  355. * settings.
  356.  
  357. @8      macrobegin
  358.         cursorright gotoblockbeg jtrue A
  359.         markline gotoblockbeg jtrue OK pause jump B
  360.      A: gotoblockend unmarkblock markline prevposition
  361.      B: markline
  362.     OK: setscreenoff addline gotoblockbeg
  363.   WRAP: wrappara iscursorinblock jtrue WRAP
  364.         delline unmarkblock
  365. *
  366. * 36 bytes Wed  12-18-1991  15:43:57 (TH @8, to JM #20/66)
  367. * 33 bytes Tue  12-31-1991  18:22:17 (TH @8, shortened)
  368.  
  369. * 
  370. * ----------------------------------------------------------------------
  371. * @(9) Format File
  372. * ----------------------------------------------------------------------
  373. @9 MacroBegin Begfile FORMAT: WrapPara NextPara jtrue FORMAT
  374. *
  375. * 26 bytes Wed  09-12-1990  16:47:
  376. * 10 bytes Wed  12-04-1991  10:57:45 (TH @9, shortened)
  377.  
  378. * 
  379. * ----------------------------------------------------------------------
  380. * @(0) Generic Macro To Process Blocks
  381. * ----------------------------------------------------------------------
  382. * This  macro is  useful for processing  a  block and  returning to the
  383. * original marked processed block.  Insert commands to process any type
  384. * block below the line <<<< Process  block >>>>.  An example using this
  385. * generic  macro  is in  @5  to format  all  lines marked  as  a block.
  386.  
  387. * See @8 and @t in rfr002.qm for a block processing technique not using
  388. * temporary files; block  is moved to  and processed at  the end of the
  389. * current file.
  390.  
  391. @0      macrobegin
  392.         onewindow
  393.         cursorright gotoblockend jtrue A markline
  394.         gotoblockend jtrue OK makectrofscreen Pause jump B
  395.      A: gotoblockbeg unmarkblock markline prevposition
  396.      B: markline
  397.     OK:
  398.         setscreenoff                                * Remove if not v2.15
  399.         addline 10                                  * Change if needed
  400.         editfile "NUL" return quit gotoblockbeg cut
  401.         paste fillblock " " return
  402.         horizontalwindow editfile return paste      * Paste block to nul
  403.         gotoblockbeg cursorup jtrue DEL endfile     * (fix) for diff qconfig
  404.    DEL: endline begline jtrue NEXT                  * Test if empty
  405.         delline                                     * Delete extra line
  406.   NEXT:
  407.         gotoblockbeg
  408. *--<<<< Process block >>>>
  409.         begfile unmarkblock markcolumn
  410.         endfile gotocolumn "512" return
  411.         cut quit
  412.         prevwindow onewindow pasteover              * Paste block back
  413.         gotoblockend cursordown
  414.   LOOP: delline endline begline jfalse LOOP         * Removes extra lines
  415.   DONE: gotoblockbeg * unmarkblock
  416. *
  417. * 89 bytes Wed  12-18-1991  13:17:20 (TH @0)
  418. * 88 bytes Wed  12-18-1991  17:11:47 (TH @0, keep block marked)
  419. * 86 bytes Mon  12-30-1991  13:32:03 (TH @0, shortened)
  420. * 90 bytes Wed  01-01-1992  15:11:14 (TH @0, for all qconfig's)
  421.  
  422. * 
  423. * ----------------------------------------------------------------------
  424. * @(f1) Reformat ONLY Lines Wider Than Right Margin 80, QEdit 2.15 Only
  425. * ----------------------------------------------------------------------
  426. @f1     macrobegin
  427.         setscreenoff
  428.     LOOP:
  429.         gotocolumn "80" return isendline jtrue NOWRAP
  430.         addline cursorup wrappara delline
  431.         jump LOOP
  432.     NOWRAP:
  433.         cursordown jfalse END
  434.         isemptyline jfalse LOOP
  435.     END:
  436. *
  437. * 33 bytes Mon  03-30-1992  18:49:35 (TH @f1, HD #21/5235)
  438. * 30 bytes Tue  03-31-1992  15:35:11 (TH @f1, shortened)
  439.  
  440. * 
  441. * ----------------------------------------------------------------------
  442. * @(f2) Reformat ONLY Lines Wider Than Right Margin 80, QEdit v2.10 or 2.15
  443. * ----------------------------------------------------------------------
  444. @f2     macrobegin
  445.     LOOP:
  446.         endline #173 gotocolumn "80" return
  447.         find #173 return delline return jfalse NOWRAP
  448.         delch addline cursorup wrappara delline
  449.         jump LOOP
  450.     NOWRAP:
  451.         find return "g" return delch
  452.         cursordown jfalse END
  453.         endline begline jtrue LOOP
  454.     END:
  455. *
  456. * 48 bytes Mon  03-30-1992  19:08:29 (TH @f2, HD #21/5235)
  457. * 45 bytes Tue  03-31-1992  15:35:26 (TH @f2, shortened)
  458.  
  459. * 
  460. * ----------------------------------------------------------------------
  461. * @(f5) Format Paragraph With or W/O Multiple Indentions
  462. *       To The Current Right Margin Setting and Left Margin Column 1
  463. * ----------------------------------------------------------------------
  464. * This macro will format to the  current right margin setting and a left
  465. * margin of  column 1 a  paragraph with or  without multiple indentions.
  466. * The paragraph must  be separated by  blank lines from  the first blank
  467. * line above  the cursor line  to the  next blank line  below the cursor
  468. * line.  Non-indented lines *must* be in column 1.  Macro requires QEdit
  469. * v2.15.   This macro  was  written at  the  request of  Jim  Bates in a
  470. * SmartNet  echo  Message  on SemWare  Conference  23,  Message  # 1468,
  471. * 4-28-92.
  472.  
  473. * If non-indented lines  do not begin  in col 1,  a paragraph containing
  474. * multiple indentions  may be  formatted with a  left margin  of 1 using
  475. * @f7  below by  changing  the last  gotocolumn  return line  in  @f7 to
  476. * gotocolumn "1"  return or  just begline.   This revised  macro will be
  477. * considerably longer than  @f5, but the added  versatility may be worth
  478. * it.
  479.  
  480. * For   example,  with  the  cursor  anywhere  in  the  following  three
  481. * indented paragraphs without the asterisks,  and a right margin setting
  482. * of 55:
  483.  
  484. * This:
  485.  
  486. *         This is parapraph 1 to format all lines of a paragraph containing
  487. * multiple indentions to user selected left and right margins.
  488. *         This is parapraph 2 to format all lines of a paragraph containing
  489. * multiple indentions to user selected left and right margins.
  490. *         This is parapraph 3 to format all lines of a paragraph containing
  491. * multiple indentions to user selected left and right margins.
  492.  
  493. * Becomes this:
  494.  
  495. *         This is parapraph 1 to format all lines of a
  496. * paragraph containing multiple indentions to user
  497. * selected left and right margins.
  498. *         This is parapraph 2 to format all lines of a
  499. * paragraph containing multiple indentions to user
  500. * selected left and right margins.
  501. *         This is parapraph 3 to format all lines of a
  502. * paragraph containing multiple indentions to user
  503. * selected left and right margins.
  504.  
  505.  
  506. @f5         macrobegin
  507.             setscreenoff                * Turn off screen 'till done
  508.             endpara                     * Move to end of para
  509.             addline cursorup            * Add line in case we're at eof
  510.             unmarkblock markline        * Mark end of para
  511.             prevpara markline           * Mark all indented para's to reformat
  512.      SPLIT: cursordown                  * Move down one line from indent
  513.             iscursorinblock jfalse TOP  * Begin format when we're out of block
  514.             firstnonwhite               * Move to first char on line
  515.             isbegline jtrue SPLIT       * Test if we're on indent
  516.             insertline cursordown       * Insert line if not on indent
  517.             jump SPLIT                  * Continue 'til all para's are split
  518.      TOP:   gotoblockbeg                * Go to first indented line
  519.      WRAP:  wrappara                    * Format each split para
  520.             delline                     * Delete extra blank line
  521.             iscursorinblock jtrue WRAP  * Continue until we're out of block
  522.             unmarkblock                 * Unmark block
  523.             nextpara                    * Pos on next para
  524. *
  525. * 36 bytes Sat  05-02-1992  13:33:00 (TH @6, to JB #20/1474 as @6)
  526. * 36 bytes Thu  05-07-1992  14:55:05 (TH @f5, changed key from @6)
  527. * 36 bytes Thu  05-14-1992  21:34:02 (TH @f5, to JB #23/1491 -93)
  528.  
  529. * 
  530. * ----------------------------------------------------------------------
  531. * @(f6)  Format Paragraph With or W/O Multiple Indentions
  532. *        To User Selected Left and Right Margins,  Requires QEdit v2.15
  533. * ----------------------------------------------------------------------
  534. * This macro will  format to a  user selected left  and right margins a
  535. * paragraph with or without multiple indentions.  The paragraph must be
  536. * separated by blank  lines from the first  blank line above the cursor
  537. * line to the  next blank line  below the cursor  line.  Macro requires
  538. * QEdit v2.15.
  539.  
  540. * At the  first pause  change or  accept the  left margin  at the "goto
  541. * column"  prompt.  At  the  second pause  change  or accept  the right
  542. * margin setting.
  543.  
  544. *     The following paragraph, without the asterisks and leading single
  545. * spaces and with a user selected left  margin of 15 and a right margin
  546. * of 55:
  547.  
  548. *         This is parapraph 1 to format all lines of a paragraph containing
  549. * multiple indentions to user selected left and right margins.
  550. *         This is parapraph 2 to format all lines of a paragraph containing
  551. * multiple indentions to user selected left and right margins.
  552. *         This is parapraph 3 to format all lines of a paragraph containing
  553. * multiple indentions to user selected left and right margins.
  554.  
  555. * Formats to:
  556.  
  557. *                     This is parapraph 1 to format all
  558. *             lines of a paragraph containing multiple
  559. *             indentions to user selected left and
  560. *             right margins.
  561. *                     This is parapraph 2 to format all
  562. *             lines of a paragraph containing multiple
  563. *             indentions to user selected left and
  564. *             right margins.
  565. *                     This is parapraph 3 to format all
  566. *             lines of a paragraph containing multiple
  567. *             indentions to user selected left and
  568. *             right margins.
  569.  
  570. @f6    macrobegin savesettings setautoindentmode setsoundoff setinsmode
  571.     * ------------------------ Mark Paragraph ------------------------*
  572.             setscreenoff                * Turn off screen 'til done
  573.             endpara                     * Move to end of para
  574.             addline cursorup            * Add line in case we're at eof
  575.             unmarkblock markline        * Mark end of para
  576.             prevpara markline           * Mark all indented para's to reformat
  577.         gotoblockend
  578.     * --- Convert Line Block To Column Block (From @3 mis003.qm ) ---*
  579.      1: begline addline "*" #173 gotoblockbeg
  580.      2: isemptyline jfalse 3 cursordown jump 2
  581.      3: firstnonwhite markcolumn endline cursorleft
  582.      4: cursordown isemptyline jtrue 4 isendline jtrue 5 endline cursorleft
  583.      5: markcolumn
  584.         Find "*" #173 return delline return jfalse 6
  585.         prevposition firstnonwhite iscursorinblock jtrue 4 markcolumn jump 4
  586.      6: delline insertline gotoblockbeg * Delete end of block marker
  587.     * --------------- Move Block Temporarily To Col 1 ---------------*
  588.         begline moveblock
  589.     * ---------------- Split Paragraph at Indentions ----------------*
  590.      SPLIT: cursordown                  * Move down one line from indent
  591.             iscursorinblock jfalse TOP  * Begin format when we're out of block
  592.             firstnonwhite               * Move to first char on line
  593.             isbegline jtrue SPLIT       * Test if we're on indent
  594.             insertline cursordown       * Insert line if not on indent
  595.             jump SPLIT                  * Continue 'til all para's are split
  596.      TOP:   gotoblockbeg                * Pos to format
  597.     * ------------- Select or Accept Left/Right Margins -------------*
  598.         setscreenon
  599.         toggleinsert                    * Toggle Insert Off to overwrite
  600.         gotocolumn begline pause return * Select or accept left  margin
  601.         setrmargin begline pause return * Select or accept right margin
  602.         setscreenoff
  603.     * ------------ Move Block, Reformat, Rejoin at Splits ------------*
  604.         moveblock                       * Move block to left margin setting
  605.      WRAP:  wrappara                    * Format each split para
  606.             delline                     * Delete blank line caused by split
  607.             iscursorinblock jtrue WRAP  * Continue until we're out of block
  608.             delline                     * Delete extra blank line
  609.             unmarkblock                 * Unmark block
  610.             nextpara                    * Pos on next para
  611. *
  612. * 111 bytes Thu  05-07-1992  17:45:40 (TH @f6)
  613. * 111 bytes Thu  05-14-1992  21:35:06 (TH @f6, to JB #23/1491 -93)
  614.  
  615. * 
  616. * ----------------------------------------------------------------------
  617. * @(f7)  Format Paragraph With or W/O Multiple Indentions
  618. *        Without Pause To User Selected Left and Right Margins
  619. *        Set With @f6, @f9 or Last GoToColumn 'nn'
  620. * ----------------------------------------------------------------------
  621. *     This macro  will format without  pause all lines  of a paragraph
  622. * with or without multiple indentions to left and right margins either
  623. * set after invoking @f6 at least  one time or setting the left margin
  624. * with  gotocolumn  'nn' return.   It  differs from  macro  @f6, which
  625. * enables to the user  to select margins at  the pause's.  See @f6 for
  626. * example.
  627.  
  628. @f7    macrobegin savesettings setautoindentmode setsoundoff setinsmode
  629.     * ------------------------ Mark Paragraph ------------------------*
  630.             setscreenoff                * Turn off screen 'til done
  631.             endpara                     * Move to end of para
  632.             addline cursorup            * Add line in case we're at eof
  633.             unmarkblock markline        * Mark end of para
  634.             prevpara markline           * Mark all indented para's to reformat
  635.     * --- Convert Line Block To Column Block (From @3 mis003.qm ) ---*
  636.         gotoblockend
  637.      1: begline addline "*" #173 gotoblockbeg
  638.      2: isemptyline jfalse 3 cursordown jump 2
  639.      3: firstnonwhite markcolumn endline cursorleft
  640.      4: cursordown isemptyline jtrue 4 isendline jtrue 5 endline cursorleft
  641.      5: markcolumn
  642.         Find "*" #173 return delline return jfalse 6
  643.         prevposition firstnonwhite iscursorinblock jtrue 4 markcolumn jump 4
  644.      6: delline insertline gotoblockbeg * Delete end of block marker
  645.     * --------------- Move Block Temporarily To Col 1 ---------------*
  646.         begline moveblock
  647.     * ---------------- Split Paragraph at Indentions ----------------*
  648.      SPLIT: cursordown                  * Move down one line from indent
  649.             iscursorinblock jfalse TOP  * Begin format when we're out of block
  650.             firstnonwhite               * Move to first char on line
  651.             isbegline jtrue SPLIT       * Test if we're on indent
  652.             insertline cursordown       * Insert line if not on indent
  653.             jump SPLIT                  * Continue 'til all para's are split
  654.      TOP:   gotoblockbeg                * Pos to format
  655.     * ------------ Move Block, Reformat, Rejoin at Splits ------------*
  656.         gotocolumn return               * Pos at gotocolumn setting
  657.         moveblock                       * Move block to left margin setting
  658.      WRAP:  wrappara                    * Format each split para
  659.             delline                     * Delete blank line caused by split
  660.             iscursorinblock jtrue WRAP  * Continue until we're out of block
  661.             delline                     * Delete extra blank line
  662.             unmarkblock                 * Unmark block
  663.             nextpara                    * Pos on next para
  664. *
  665. * 102 bytes Thu  05-07-1992  17:45:18 (TH @f7)
  666. * 102 bytes Thu  05-14-1992  21:35:28 (TH @f7, to JB #23/1491 -93)
  667.  
  668.  
  669. * 
  670. * ----------------------------------------------------------------------
  671. * @(f8) Format All Lines Containing Any Type Block
  672. *       To User Selected Left and Right Margins,  Requires QEdit v2.15
  673. * ----------------------------------------------------------------------
  674. *     This macro will format all lines containing any type open or
  675. * closed block to user selected left and right margins.  If a block is
  676. * not marked before execution, at the first pause cursor down to the
  677. * end of the desired block and press <enter>.  At the second pause
  678. * change or accept the left margin at the "goto column" prompt.  At the
  679. * third pause change or accept the right margin setting.  This macro
  680. * will not work with paragraphs containing multiple indentions like
  681. * @f5-F7 above.
  682.  
  683. *     To format all lines in a file to a user selected left and right
  684. * margins, mark the file as a line block.  For large files, this macro
  685. * can be very slow because of the routine to convert to a column block.
  686.  
  687. *     The first paragraph, without the asterisks and leading single
  688. * spaces, formats with a left margin of 15 and a right margin of 55 to:
  689.  
  690. *                 This macro will format all lines
  691. *             containing any type open or closed block
  692. *             to user selected left and right margins.
  693. *             If a block is not marked before
  694. *             execution, at the first pause cursor down
  695. *             to the end of the desired block and press
  696. *             <enter>. At the second pause enter or
  697. *             accept the left margin at the "goto
  698. *             column" prompt.  At the third pause enter
  699. *             or accept the right margin setting.
  700.  
  701. @f8     macrobegin savesettings setautoindentmode setsoundoff setinsmode
  702.     * -------- Select And Mark Block To Format If Not Marked --------*
  703.         gotoblockend jtrue A  markline gotoblockend jtrue OK  pause jump B *|
  704.      A: gotoblockbeg unmarkblock markline prevposition                     *|b
  705.      B: markline gotoblockend                                              *|
  706.     OK: setscreenoff
  707.     * --- Convert Line Block To Column Block (From @3 mis003.qm ) ---*
  708.      1: begline addline "*" #173 gotoblockbeg                              *|b
  709.      2: isemptyline jfalse 3 cursordown jump 2
  710.      3: firstnonwhite markcolumn endline cursorleft
  711.      4: cursordown isemptyline jtrue 4 isendline jtrue 5 endline cursorleft
  712.      5: markcolumn
  713.         Find "*" #173 return delline return jfalse 6
  714.         prevposition firstnonwhite iscursorinblock jtrue 4 markcolumn jump 4
  715.      6: delline insertline gotoblockbeg * Delete end of block marker
  716.     * ------------- Select or Accept Left/Right Margins -------------*
  717.         setscreenon
  718.         toggleinsert                    * Toggle Insert Off to overwrite
  719.         begline                         * In case left margin not entered
  720.         gotocolumn begline pause return * Select or accept left  margin
  721.         setrmargin begline pause return * Select or accept right margin
  722.     * ------------------- Move Block And Reformat -------------------*
  723.         setscreenoff moveblock          * Move block to left margin setting
  724.   WRAP: wrappara                        * Format
  725.         iscursorinblock jtrue WRAP      * Until we're out of block
  726.         delline                         * Delete extra empty line
  727.         isemptyline jfalse 7 nextpara   * Move to next para if empty line
  728.      7: firstnonwhite makectrofscreen   * Pos on next para
  729.         unmarkblock restoresettings
  730. *
  731. *  96 bytes Sat  04-25-1992  13:54:29 (TH @f8, to DD #20/609)
  732. * 112 bytes Sun  04-26-1992  15:43:12 (TH @f8, keep para brks, chg end pos)
  733. * 111 bytes Tue  04-28-1992  07:59:38 (TH @f8, shortened *|b)
  734. * 111 bytes Thu  05-07-1992  23:38:08 (TH @f8, to JB #23/1483)
  735. * 111 bytes Thu  05-14-1992  21:35:43 (TH @f8, to JB #23/1491 -93)
  736.  
  737. * 
  738. * ----------------------------------------------------------------------
  739. * @(f9) Format Paragraph With or W/O Multiple Indentions
  740. *       Set With @f8, @f6 or Last GoToColumn 'nn'
  741. * ----------------------------------------------------------------------
  742. *     This macro will format a paragraph with or without multiple
  743. * indentions to a left margin of the last entry in the "goto column"
  744. * prompt and the current right margin setting.  It may be used
  745. * repeatedly without pausing after invoking @f8 or gotocolumn 'nn'
  746. * return,
  747.  
  748. *     To have this macro "behave" like the "WrapPara" command and
  749. * format a paragraph from the cursor line to the end of the paragraph,
  750. * remove "endpara prevpara" line.  This macro will fit on one line of
  751. * Qconfig.dat and requires QEdit v2.15.
  752.  
  753. *     The above paragraph, without the asterisks and leading single
  754. * spaces, formats with a left margin of 10 and a right margin of 60 to:
  755.  
  756. *            This macro will format a paragraph to a left
  757. *        margin of the last entry in the "goto column"
  758. *        prompt and the current right margin setting.  To
  759. *        have this macro "behave" like the "WrapPara"
  760. *        command and move/format a paragraph from the cursor
  761. *        line to the end of the paragraph, remove "endpara
  762. *        prevpara" line.  This macro will fit on one line of
  763. *        Qconfig.dat and requires QEdit v2.15.
  764.  
  765. @f9     macrobegin savesettings setautoindentmode setsoundoff setscreenoff
  766.     * -------------- Position Cursor At Paragraph Begin --------------*
  767.         endpara prevpara            * Remove line to act like "WordWrap"   *|
  768.     * ---- Convert Paragraph To Column Block (From @5 mis003.qm) ----*
  769.         firstnonwhite               * Pos on first char current line       *|
  770.         unmarkblock markcolumn      * Start column block                   *|
  771.         endline cursorleft          * Make line 1 column block             *|
  772.      1: cursordown jfalse 3         * Move down to next line               *|
  773.         isemptyline jtrue 4         *ELSE not eof, test if end of para     *|
  774.         markcolumn                  *ELSE not end of para, extend block    *|
  775.         firstnonwhite               * Move to first char                   *|
  776.         iscursorinblock jtrue 2     * Test if in block                     *|
  777.         markcolumn                  *ELSE not in block, extend block       *|
  778.         gotoblockend cursorleft     * Pos to test if past eol              *|
  779.      2: isendline jtrue 1           * Test if past eol, loop again if true *|
  780.         endline cursorleft jump 1   *ELSE inlcude eol in block, loop again *|
  781.      3: addline                     * Para ends at eof, add empty line eof *|
  782.      4: gotoblockbeg                * Pos block begin                      *|
  783.     * ------------------- Move Paragraph, Reformat -------------------*
  784.         begline                     * In case no gotocolumn setting
  785.         gotocolumn return           * Goto previous "goto column" setting
  786.         moveblock                   * Move paragraph here finally
  787.         wrappara                    * Format it
  788.         nextpara makectrofscreen    * Pos on next para                     *|
  789.         unmarkblock restoresettings
  790. *
  791. * 75 bytes Sat  04-25-1992  14:06:23 (TH @f9, to DD #20/609)
  792. * 52 bytes Sun  04-26-1992  12:13:58 (TH @f9, shortened)
  793. * 52 bytes Thu  05-14-1992  21:36:01 (TH @f9, to JB #23/1491 -93)
  794.  
  795. * 
  796. * ----------------------------------------------------------------------
  797. * ^(f7_) Format Message Reader Paragraph
  798. * ----------------------------------------------------------------------
  799. * Here's a handy macro from Tim Farley of SemWare to reformat a message
  800. * reader paragraph.  Remember, paragraphs  are reformatted to the width
  801. * of the right  margin setting, so set  as needed.  PLEASE see MSGxx.QM
  802. * msg002.qm for @8, the most recent version of this macro.
  803.  
  804.  
  805. * =========================================================================
  806. * Date: 10-01-90 (19:09)           Number: 3041         SemWare Support BBS
  807. *   To: DAN SNAPPER                Refer#: 3028
  808. * From: TIM FARLEY                   Read: YES
  809. * Subj: Message reformat macro       Conf: (21) ILink
  810. * ------------------------------------------------------------------------
  811. * DS>   Does anyone have a macro to reformat a quoted 'off-line'
  812. * DS>   message paragraph and then reinsert the quotes back?
  813. * DS>
  814. * DS>
  815. * DS>
  816.  
  817. * Here it is:
  818.  
  819. * Reader Paragraph Reform
  820. *   Mark a line block, hit this key, and it will reform the text, leaving
  821. *   all "II>" quoting on the left alone.
  822.  
  823. *   Assumes that ">" is the last character of the "quoting" mark.
  824. *   Also assumes that WordWrap is currently on when you hit it,
  825. *   and that there is a currently marked block.
  826.  
  827. * ^f7  MacroBegin OneWindow
  828. *      GotoBlockBeg GotoBlockEnd JTrue doit  MarkLine GotoBlockEnd
  829. *    doit:
  830. *      ToggleWordWrap EndLine #254 ToggleWordWrap
  831. *      GotoBlockBeg GotoColumn "16" Return Find ">" Return "BL" Return
  832. *      JTrue foundit
  833. *      BegLine
  834. *    foundit:
  835. *      CursorRight
  836. *      UnmarkBlock MarkColumn Find #254 Return "N" Return
  837. *      GotoColumn "512" Return MarkColumn BegLine GotoBlockBeg
  838. *      Cut
  839. *      MarkLine CopyBlock CopyBlock CopyBlock UnmarkBlock
  840. *      HorizontalWindow EditFile "$$$$$$$$.tmp" Return
  841. *      BegFile BegLine         * Top of files in case it was already here
  842. *      InsertLine InsertLine   * ??
  843. *      Paste UnMarkBlock       * put block in place
  844. *      EndFile AddLine BegFile * mandatory blank line on end
  845. *    more:
  846. *      WrapPara                * wrap each para
  847. *      JTrue more              * until none left
  848. *      DelLine
  849. *      BegFile BegLine
  850. *      Find Return Return      * find our goofy char again
  851. *      DelCh                   * and delete it
  852. *      GotoColumn "512" Return MarkColumn BegFile BegLine MarkColumn
  853. *      Cut Quit PrevWindow OneWindow
  854. *      Paste GotoBlockEnd CursorDown BegLine UnMarkBlock
  855.  
  856. *
  857. * 132 bytes Tue  10-02-1990  16:51:06 (added TH)
  858.  
  859. * This macro is too long for QCONFIG, you'll have to use QMAC to
  860. * compile it.  Then put the compiled macro files in some directory,
  861. * and add the following option to the command line your reader runs
  862. * QEdit with:
  863. *
  864. *      /Ld:\dir\filename.ext
  865. *
  866. * where D:\DIR\FILENAME.EXT is the full drive, path, and name of
  867. * the compiled binary macro file.
  868. *
  869. * I've used this macro myself to reformat quotes, for over a year
  870. * now.
  871. *
  872. * --Tim Farley
  873. *   SemWare Technical Support
  874.  
  875.  
  876.